export function TodayDataUtils(day) {
    let today = new Date();
    var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
    today.setTime(targetday_milliseconds);
    var tYear = today.getFullYear();
    var tMonth = today.getMonth();
    var tDate = today.getDate();
    tMonth = doHandleMonth(tMonth + 1);
    tDate = doHandleMonth(tDate);
    let oneDaya = tYear + "-" + tMonth + "-" + tDate;

    let dayList = new Date();
    var thYear = dayList.getFullYear();
    var thMonth = dayList.getMonth();
    var thDate = dayList.getDate();
    thMonth = doHandleMonth(thMonth + 1);
    thDate = doHandleMonth(thDate);
    let twoDaya = thYear + "-" + thMonth + "-" + thDate;

    return {
        oneDaya, twoDaya
    }
}



export function TodayDataTimeUtils(day) {
    let today = new Date();
    var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
    today.setTime(targetday_milliseconds);
    var tYear = today.getFullYear();
    var tMonth = today.getMonth();
    var tDate = today.getDate();
    var tHours = today.getHours();
    var tMinutes = today.getMinutes();
    var tSeconds = today.getSeconds();
    tMonth = doHandleMonth(tMonth + 1);
    tDate = doHandleMonth(tDate);
    tHours = doHandleMonth(tHours);
    tMinutes = doHandleMonth(tMinutes);
    tSeconds = doHandleMonth(tSeconds);
    let oneDaya = tYear + "-" + tMonth + "-" + tDate + " " + "00" + ":" + "00" + ":" + "00";

    let dayList = new Date();
    var thYear = dayList.getFullYear();
    var thMonth = dayList.getMonth();
    var thDate = dayList.getDate();
    var thHours = dayList.getHours();
    var thMinutes = dayList.getMinutes();
    var thSeconds = dayList.getSeconds();
    thMonth = doHandleMonth(thMonth + 1);
    thDate = doHandleMonth(thDate);
    thHours = doHandleMonth(tHours);
    thMinutes = doHandleMonth(tMinutes);
    thSeconds = doHandleMonth(tSeconds);
    let twoDaya = thYear + "-" + thMonth + "-" + thDate + " " + "00" + ":" + "00" + ":" + "00";

    return {
        oneDaya, twoDaya
    };
}



export function getNowDateTime() {
    let dayList = new Date();
    var thYear = dayList.getFullYear();
    var thMonth = dayList.getMonth();
    var thDate = dayList.getDate();
    var tHours = dayList.getHours();
    var tMinutes = dayList.getMinutes();
    var tSeconds = dayList.getSeconds();
    thMonth = doHandleMonth(thMonth + 1);
    thDate = doHandleMonth(thDate);
    return thYear + "-" + thMonth + "-" + thDate + tHours + ":" + tMinutes + ":" + tSeconds;
}

function doHandleMonth(month) {
    var m = month;
    if (month.toString().length == 1) {
        m = "0" + month;
    }
    return m;
}